home *** CD-ROM | disk | FTP | other *** search
/ MacPeople 2003 February 1 / MACPEOPLE-2003-02-01.ISO.7z / MACPEOPLE-2003-02-01.ISO / ぶらりオンラインウェアの旅 / おしゃべり漂流記 / xGates / xGates 1.2 Source Code.sit / xGates 1.2 Source Code / graphics.c < prev    next >
Text File  |  2002-12-08  |  46KB  |  1,318 lines

  1. /*
  2.     xGates -- Stunningly entertaining action game for MacOS Classic / MacOS X
  3.     Copyright (C) 2002 Sveinbjorn Thordarson <paladeen@soth.zoneit.com>
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     graphics.c
  20.  
  21. */
  22.  
  23. #include "externs.h"
  24. #include "prototypes.h"
  25. #include "definitions.h"
  26.  
  27.  
  28.  
  29.  
  30. Rect    weaponRect;
  31.  
  32.  
  33. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  34. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  35. ////////////////////////////////////Drawing functions for the game workmap//////////////////////////////////
  36. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  37. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  38.  
  39.  
  40.  
  41.  
  42. //////////////////////////////////////////////////////
  43. //Draw the entire game board to the offscreen gworld workmap
  44. //////////////////////////////////////////////////////
  45.  
  46. void DrawGameBoard (void)
  47. {
  48.     EraseWorkMapRect(&gameScreenSize);
  49.  
  50.        DrawCornersToWorkMap();
  51.     DrawMacsToWorkMap();
  52.     DrawPoofsToWorkMap();
  53.     DrawSteveToWorkMap();
  54.     DrawDojsToWorkMap();
  55.     DrawBillsToWorkMap();
  56.     DrawBottomBarToWorkMap();
  57.     DrawStatusBarToWorkMap();//score, bills and DoJs
  58.     DrawWeaponToWorkMap();
  59. }
  60.  
  61.  
  62. //////////////////////////////////////////////////////
  63. //Draw the little corners that make the game look
  64. //soooo much better in 640x480 resolution
  65. //////////////////////////////////////////////////////
  66.  
  67. void DrawCornersToWorkMap (void)
  68. {
  69.     Rect    cornerRects[2] = { { 0, 0, 8, 8 }, { 0, 632, 8, 640 } }; 
  70.     CGrafPtr    buffPort;
  71.  
  72.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  73.  
  74.     CopyBits((BitMap *)*cornerPix[0], GetPortBitMapForCopyBits(buffPort), &cornerSize, &cornerRects[0], transparent, nil);
  75.     CopyBits((BitMap *)*cornerPix[1], GetPortBitMapForCopyBits(buffPort), &cornerSize, &cornerRects[1], transparent, nil);
  76.  
  77. }
  78.  
  79. //////////////////////////////////////////////////////
  80. //Draw the Macs in the level
  81. //////////////////////////////////////////////////////
  82. void DrawMacsToWorkMap (void)
  83. {
  84.     short   i, type,state, countdown;
  85.     Rect    myMacRect, screenTopRect, screenBottomRect, destRect;
  86.     CGrafPtr    buffPort;
  87.     
  88.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  89.  
  90.     
  91.     for (i = 0; i < levels[currentLevel].numOfMacs; i++)
  92.     {
  93.         type = levels[currentLevel].macs[i].type;
  94.         state = levels[currentLevel].macs[i].state;
  95.         countdown = levels[currentLevel].macs[i].countdown;
  96.     
  97.         myMacRect.top = levels[currentLevel].macs[i].yloc;
  98.         myMacRect.left = levels[currentLevel].macs[i].xloc;
  99.         myMacRect.bottom = myMacRect.top + macRects[type][kMacOS].bottom;
  100.         myMacRect.right = myMacRect.left + (macRects[type][state].right-macRects[type][state].left);
  101.         
  102.         
  103.         
  104.         //this means that we have to draw the mac with a zooming blue screen, using both winXP pic and bluescreen pic
  105.         if (state == kWinCrash && countdown > 0)
  106.         {
  107.             //draw the underlying winxp pic
  108.             CopyBits((BitMap *)*macPix[type], GetPortBitMapForCopyBits(buffPort), &macRects[type][kWinXP], &myMacRect, srcCopy, nil);
  109.             
  110.             
  111.             //top blue area
  112.             screenTopRect.top = macRects[type][kWinCrash].top + macScreenRects[type].top;
  113.             screenTopRect.left = macRects[type][kWinCrash].left + macScreenRects[type].left;
  114.             screenTopRect.bottom = screenTopRect.top + absolute(countdown - ((macScreenRects[type].bottom - macScreenRects[type].top)/2));
  115.             screenTopRect.right = macRects[type][kWinCrash].left + macScreenRects[type].right+1;
  116.             
  117.             destRect = myMacRect;
  118.             
  119.             destRect.top += screenTopRect.top;
  120.             destRect.bottom = destRect.top + (screenTopRect.bottom - screenTopRect.top);
  121.             destRect.left += macScreenRects[type].left;
  122.             destRect.right = destRect.left + (macScreenRects[type].right - macScreenRects[type].left)+1;
  123.  
  124.             CopyBits((BitMap *)*macPix[type], GetPortBitMapForCopyBits(buffPort), &screenTopRect, &destRect, srcCopy, nil);
  125.             
  126.             //bottom blue area
  127.             screenBottomRect.top = screenTopRect.bottom - absolute(countdown - ((macScreenRects[type].bottom - macScreenRects[type].top)/2));
  128.             screenBottomRect.left = macRects[type][kWinCrash].left + macScreenRects[type].left;
  129.             screenBottomRect.bottom = macRects[type][kWinCrash].top + macScreenRects[type].bottom;
  130.             screenBottomRect.right = macRects[type][kWinCrash].left + macScreenRects[type].right+1;
  131.             
  132.             destRect = myMacRect;
  133.             
  134.             destRect.bottom = destRect.top + macScreenRects[type].bottom+1;
  135.             destRect.top = destRect.bottom - absolute(countdown - ((macScreenRects[type].bottom - macScreenRects[type].top))/2);
  136.             destRect.left += macScreenRects[type].left;
  137.             destRect.right = destRect.left + (macScreenRects[type].right - macScreenRects[type].left)+1;
  138.             
  139.             CopyBits((BitMap *)*macPix[type], GetPortBitMapForCopyBits(buffPort), &screenBottomRect, &destRect, srcCopy, nil);
  140.             
  141.             
  142.         }
  143.         else
  144.         {
  145.             CopyBits((BitMap *)*macPix[type], GetPortBitMapForCopyBits(buffPort), &macRects[type][state], &myMacRect, srcCopy, nil);
  146.         }
  147.     }
  148.  
  149.  
  150. }
  151.  
  152. //////////////////////////////////////////////////////
  153. //Draw the Bills
  154. //////////////////////////////////////////////////////
  155. void DrawBillsToWorkMap (void)
  156. {
  157.     short i;
  158.     Rect theBillRect;
  159.     CGrafPtr    buffPort;
  160.     
  161.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  162.     
  163.     for (i = 0; i < numOfBills; i++)
  164.     {
  165.         theBillRect = *GetBillRect(i);
  166.  
  167.         //let's be safe and check if state is valid
  168.         if (bills[i].state > 5 || bills[i].state < 0)
  169.             bills[i].state = 0;
  170.         
  171.         CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[bills[i].state], &theBillRect, transparent, nil);
  172.     }
  173. }
  174.  
  175. //////////////////////////////////////////////////////
  176. //Draw the poofs
  177. //////////////////////////////////////////////////////
  178. void DrawPoofsToWorkMap (void)
  179. {
  180.     short   i;
  181.     Rect    thePoofRect;
  182.      CGrafPtr    buffPort;
  183.  
  184.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  185.     
  186.     for (i = 0; i < numOfPoofs; i++)
  187.     {
  188.         thePoofRect.top = poofs[i].yloc;
  189.         thePoofRect.left = poofs[i].xloc;
  190.         thePoofRect.bottom = thePoofRect.top + poofSizes[0].bottom;
  191.         thePoofRect.right = thePoofRect.left + poofSizes[0].right;
  192.         
  193.         //let's be safe and check if state is valid
  194.         if (poofs[i].state > 4 || poofs[i].state < 0)
  195.             poofs[i].state = 0;
  196.         
  197.         CopyBits((BitMap *)*poofPix, GetPortBitMapForCopyBits(buffPort), &poofSizes[poofs[i].state], &thePoofRect, transparent, nil);
  198.     }
  199. }
  200.  
  201. //////////////////////////////////////////////////////
  202. //Draw THE MAN himself
  203. //////////////////////////////////////////////////////
  204. void DrawSteveToWorkMap (void)
  205. {
  206.     Rect    theSteveRect;
  207.     CGrafPtr    buffPort;
  208.  
  209.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  210.     
  211.     //if there IS a Steve walking about, draw him
  212.     if (numOfSteves)
  213.     {
  214.             theSteveRect.top = steve.yloc;
  215.             theSteveRect.left = steve.xloc;
  216.             theSteveRect.bottom = steve.yloc+64;
  217.             theSteveRect.right = steve.xloc+50;
  218.             
  219.             //let's be safe and check if state is valid
  220.             if (steve.state > 4 || steve.state < 0)
  221.                 steve.state = 0;
  222.  
  223.             CopyBits((BitMap *)*stevePix, GetPortBitMapForCopyBits(buffPort), &billRects[steve.state], &theSteveRect, transparent, nil);
  224.     }
  225. }
  226.  
  227. //////////////////////////////////////////////////////
  228. //Draw DoJs
  229. //////////////////////////////////////////////////////
  230. void DrawDojsToWorkMap (void)
  231. {
  232.     short i;
  233.      CGrafPtr    buffPort;
  234.  
  235.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  236.     
  237.     for (i = 0; i < numOfDojs; i++)
  238.     {
  239.         CopyBits((BitMap *)*deptOfJusticePix, GetPortBitMapForCopyBits(buffPort), &dojSize, &dojs[i].rect, srcCopy, nil);
  240.     }
  241. }
  242.  
  243.  
  244. //////////////////////////////////////////////////////
  245. //Draw the weapon cursor to the offscreen workmap
  246. //////////////////////////////////////////////////////
  247.  
  248.  
  249. void DrawWeaponToWorkMap (void)
  250. {
  251.     Point   mouseLoc;
  252.     CGrafPtr    buffPort;
  253.  
  254.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  255.     
  256.     GetMouse(&mouseLoc);
  257.     
  258.     if (mouseLoc.h < 0)
  259.         mouseLoc.h = 0;
  260.        if (mouseLoc.v < 0)
  261.            mouseLoc.v = 0;
  262.        if (mouseLoc.h > 640-32)
  263.            mouseLoc.h = 640-32;
  264.        if (mouseLoc.v > 460-32)
  265.            mouseLoc.v = 460-32;
  266.        
  267.     weaponRect.top = mouseLoc.v;
  268.     weaponRect.left = mouseLoc.h;
  269.     weaponRect.bottom = mouseLoc.v+chainsawSizes[0].bottom;
  270.     weaponRect.right = mouseLoc.h+chainsawSizes[0].right;
  271.  
  272.     CopyBits((BitMap *)*chainSawPix, GetPortBitMapForCopyBits(buffPort), &chainsawSizes[weaponState], &weaponRect, transparent, nil);
  273.     
  274.  
  275.  
  276.  
  277. }
  278.  
  279.  
  280.  
  281. //////////////////////////////////////////////////////
  282. //Draw the status bar listing score, bills, dojs etc.
  283. //////////////////////////////////////////////////////
  284. void DrawStatusBarToWorkMap (void)
  285. {
  286.     Rect        dojIconRect = { 465, 48, 478, 61 };
  287.     Rect        dojIconSize = { 0, 0, 13, 13 };
  288.     short       i;
  289.     Str255      myString;
  290.     CGrafPtr    buffPort;
  291.  
  292.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  293.     
  294.     SetPort(buffPort);
  295.     
  296.     RGBForeColor(&myBlackColor);
  297.     PaintRect(&dojCountUpdateRect);
  298.     PaintRect(&billCountUpdateRect);
  299.     PaintRect(&scoreCountUpdateRect);
  300.     
  301.     //switch to white and draw the actual numbers
  302.     RGBForeColor(&myWhiteColor);
  303.     TextSize(10);
  304.     TextFace(0);
  305.     
  306.         //numbills remaining
  307.         MoveTo(345, 475);
  308.         NumToString(levels[currentLevel].numBills-billsInLevel, myString);
  309.         DrawString(myString);
  310.         //score
  311.         MoveTo(515, 475);
  312.         NumToString(player.score, myString);
  313.         DrawString(myString);
  314.     
  315.     //blit the doj symbols
  316.     for (i = 0; i < player.dojs; i++)
  317.     {
  318.         RGBForeColor(&myBlackColor);
  319.         CopyBits((BitMap *)*deptOfJusticeIconPix, GetPortBitMapForCopyBits(buffPort), &dojIconSize, &dojIconRect, srcCopy, nil);
  320.         dojIconRect.left += dojIconSize.right+2;
  321.         dojIconRect.right += dojIconSize.right+2;
  322.         
  323.         if (i == 5)
  324.         {
  325.             MoveTo(dojIconRect.right-5, 475);
  326.             NumToString(player.dojs, myString);
  327.             RGBForeColor(&myWhiteColor);
  328.             DrawString(myString);
  329.             break;
  330.         }
  331.     }
  332.  
  333.     RGBForeColor(&myBlackColor);
  334. }
  335.  
  336. //////////////////////////////////////////////////////
  337. //Blit a little black box with the framerate onto workmap
  338. //////////////////////////////////////////////////////
  339. void DrawFrameRateToWorkMap (long framerate)
  340. {
  341.     Str255  str;
  342.     Rect    fpsRect = { 15, 585, 35, 632 };
  343.     CGrafPtr    buffPort;
  344.  
  345.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  346.  
  347.     SetPort(buffPort);
  348.  
  349.     //draw black square
  350.     RGBForeColor(&myBlackColor);
  351.     PaintRect(&fpsRect);
  352.     
  353.     RGBForeColor(&myWhiteColor);
  354.     NumToString(framerate, str);
  355.     TextSize(12);
  356.     TextFace(1);
  357.     MoveTo(fpsRect.left + 3, fpsRect.bottom - 5 );
  358.     DrawString(str);
  359.     DrawString("¥p fps");
  360.     
  361.     RGBForeColor(&myBlackColor);
  362. }
  363.  
  364.  
  365.  
  366.  
  367.  
  368. //////////////////////////////////////////////////////
  369. //Blit the pause sign
  370. //////////////////////////////////////////////////////
  371. void DrawPauseBarToWorkMap (void)
  372. {
  373.     CGrafPtr    buffPort;
  374.     
  375.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  376.  
  377.     CopyBits((BitMap *)*gamePausedPix, GetPortBitMapForCopyBits(buffPort), &splashButtonSizes[0], &gamePausedPicRect, transparent, nil);
  378. }
  379.  
  380.  
  381.  
  382.  
  383. //////////////////////////////////////////////////////
  384. //Draw game screen shell without game objects...that is
  385. //to say, we draw text and bar
  386. //////////////////////////////////////////////////////
  387.  
  388. void DrawBottomBarToWorkMap (void)
  389. {
  390.     Rect        bottomBarRect = { 460, 0, 480, 640 };
  391.     CGrafPtr    buffPort;
  392.  
  393.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  394.     
  395.     SetPort(buffPort);
  396.     
  397.         //black bar at bottom
  398.         RGBForeColor(&myBlackColor);
  399.         PaintRect(&bottomBarRect);
  400.         
  401.          //draw the lines
  402.         RGBForeColor(&myVeryLightGreyColor); 
  403.         MoveTo(0, 461);
  404.         LineTo(640, 461);
  405.         RGBForeColor(&myLightGreyColor);
  406.         MoveTo(0, 462);
  407.         LineTo(640,462);
  408.         RGBForeColor(&myGrayColor);
  409.         MoveTo(0, 463);
  410.         LineTo(640,463);
  411.         RGBForeColor(&myDarkGrayColor);
  412.         MoveTo(0, 464);
  413.         LineTo(640,464);
  414.  
  415.     //there's overhead in changing colors often.  Therefore we draw all the text of one color in order
  416.     //switch to grayblue color and draw the item text
  417.         //DoJ's
  418.         RGBForeColor(&myGrayBlueColor);
  419.         TextSize(10);
  420.         TextFace(0);
  421.         MoveTo(9, 475);
  422.         DrawString("¥pDoJ's  ");
  423.         //Bills Killed:
  424.         MoveTo(260, 475);
  425.         DrawString("¥pBills Remaining   ");
  426.         //score
  427.         MoveTo(470, 475);
  428.         DrawString("¥pScore  ");
  429.     
  430. }
  431.  
  432.  
  433. #pragma mark -
  434.  
  435.  
  436. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  437. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  438. ////////////////////////////////////Drawing functions for other game screen/////////////////////////////////
  439. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  440. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448. //////////////////////////////////////////////////////
  449. //Draw soth startup screen
  450. //////////////////////////////////////////////////////
  451.  
  452.  
  453. void DrawSothScreen (void)
  454. {
  455.     Rect    sothPicRect = *CenterRectInRect(&sothPicSize, &screenSize);
  456.     CGrafPtr    buffPort;
  457.     
  458.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  459.     
  460.     //start drawing to workmap
  461.     SetPort(buffPort);
  462.  
  463.         //draw a black background on the workmap
  464.             RGBForeColor(&myBlackColor);
  465.             PaintRect(&screenSize);
  466.         
  467.         //draw soth pix
  468.         CopyBits((BitMap *)*sothPix, GetPortBitMapForCopyBits(buffPort), &sothPicSize, &sothPicRect, srcCopy, nil);
  469. }
  470.  
  471.  
  472. //////////////////////////////////////////////////////
  473. //Draw splash screen
  474. //////////////////////////////////////////////////////
  475. void DrawSplashScreen (void)
  476. {
  477.     short         i;
  478.     Str255      scoreStr,placeStr;
  479.     Rect        highscoreRect = { 17, 10, 463, 241  };
  480.     Rect        splashRect = { 20, 270, 111, 583 };
  481.     Rect        haukurSplashRect = { 110, 290, 391, 590 };
  482.     
  483.     CGrafPtr    buffPort;
  484.  
  485.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  486.     
  487.     
  488.     //start drawing to workmap
  489.     SetPort(buffPort);
  490.     
  491.  
  492.             //draw a black background on the workmap
  493.             RGBForeColor(&myBlackColor);
  494.             PaintRect(&screenSize);
  495.             
  496.             CopyBits((BitMap *)*splashPix, GetPortBitMapForCopyBits(buffPort), &gameTitleSize, &splashRect, srcCopy, nil);
  497.             CopyBits((BitMap *)*highScorePix, GetPortBitMapForCopyBits(buffPort), &highscoreSize, &highscoreRect, srcCopy, nil);
  498.             CopyBits((BitMap *)*haukurSplashPix, GetPortBitMapForCopyBits(buffPort), &haukurSplashSize, &haukurSplashRect, srcCopy, nil);
  499.     
  500.     
  501.             //draw button
  502.             for (i = 0; i < 6; i++)
  503.             {
  504.                 CopyBits((BitMap *)*buttonsPix, GetPortBitMapForCopyBits(buffPort), &splashButtonSizes[i], &splashButtonRects[i], srcCopy, nil);
  505.             }
  506.             
  507.             //draw high scores
  508.             
  509.             for (i = 0; i < 16; i++)
  510.             {
  511.                 //set text style
  512.                 TextSize(10);
  513.                 TextFace(0);
  514.                 
  515.                 //get the place into string
  516.                 NumToString(i+1, placeStr);
  517.                 //get the score into string
  518.                 NumToString(prefs.highscores.score[i], scoreStr);
  519.                 
  520.                 //draw the white shadows for the text
  521.                 RGBForeColor(&myWhiteColor);
  522.                 
  523.                     //place
  524.                     MoveTo(highscoreRect.left + 14, highscoreRect.top + 55 + (i*25));
  525.                     DrawString(placeStr);
  526.                     DrawString("¥p.");
  527.                 
  528.                     //name
  529.                     MoveTo(highscoreRect.left + 37 +1, highscoreRect.top + 55 + (i*25)+1);
  530.                     DrawString(prefs.highscores.name[i]);
  531.                     
  532.                     //score
  533.                     MoveTo(highscoreRect.right - 55, highscoreRect.top + 55 + (i*25));
  534.                     DrawString(scoreStr);
  535.                     
  536.                 
  537.                 //Now, we draw the actual non-white text
  538.                 //determine colour
  539.                 //if it's the latest highscore, it's red
  540.                 if (prefs.lastHighScore == i)
  541.                     RGBForeColor(&myRedColor);
  542.                 else
  543.                     RGBForeColor(&myBlackColor);
  544.                 
  545.                 //draw place
  546.                     MoveTo(highscoreRect.left + 14, highscoreRect.top + 55 + (i*25));
  547.                     DrawString(placeStr);
  548.                     DrawString("¥p.");
  549.                 
  550.                 //draw name
  551.                     MoveTo(highscoreRect.left + 37, highscoreRect.top + 55 + (i*25));
  552.                     DrawString(prefs.highscores.name[i]);
  553.                 
  554.                 //draw score
  555.                     MoveTo(highscoreRect.right - 55, highscoreRect.top + 55 + (i*25));
  556.                     DrawString(scoreStr);
  557.                 
  558.                 
  559.             }
  560.             
  561.             
  562.             //draw menu bar info
  563.             if (!IsMenuBarVisible() && gOS != kMacOSX)
  564.             {
  565.                 RGBForeColor(&myWhiteColor);
  566.                 MoveTo(23, 477);
  567.                 DrawString("¥pPress Cmd-M to show menu bar");
  568.                 
  569.                 RGBForeColor(&myBlackColor);
  570.             }
  571.             
  572.             //draw copyright notice
  573.             
  574.             /*MoveTo(460, 477);
  575.             RGBForeColor(&myWhiteColor);
  576.             DrawString("¥pゥ2002 Sveinbjorn Thordarson");
  577.             RGBForeColor(&myBlackColor);*/
  578.  
  579. }
  580.  
  581. //////////////////////////////////////////////////////
  582. //Draw the high score prompt with the decapitated Bill
  583. //////////////////////////////////////////////////////
  584. void DrawHighScorePrompt (void)
  585. {
  586.     Rect        scoreNamePicRect = textFieldRect;
  587.     Rect        haukurHeadRect = { 19, 58, 480 ,640 };
  588.     Str255      placeStr;
  589.     CGrafPtr    buffPort;
  590.     
  591.     scoreNamePicRect.top -= 3;
  592.     scoreNamePicRect.left -= 3;
  593.     scoreNamePicRect.bottom += 3;
  594.     scoreNamePicRect.right += 3;
  595.     
  596.     
  597.  
  598.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  599.     
  600.     
  601.     //start drawing to workmap
  602.     SetPort(buffPort);
  603.  
  604.  
  605.             //draw a black background on the workmap
  606.             RGBForeColor(&myBlackColor);
  607.             PaintRect(&screenSize);
  608.             
  609.             CopyBits((BitMap *)*haukurHeadPix, GetPortBitMapForCopyBits(buffPort), &haukurHeadSize, &haukurHeadRect, srcCopy, nil);
  610.             
  611.             //blit the frame around text field
  612.             CopyBits((BitMap *)*scoreNameRectPix, GetPortBitMapForCopyBits(buffPort), &scoreNamePicSize, &scoreNamePicRect, srcCopy, nil);
  613.             
  614.             RGBForeColor(&myWhiteColor);
  615.             TextSize(14);
  616.             TextFace(0);
  617.             MoveTo(textFieldRect.left-4,textFieldRect.top - 85);
  618.             DrawString("¥pCongratulations!");
  619.             TextSize(10);
  620.             MoveTo(textFieldRect.left-4,textFieldRect.top - 65);
  621.             DrawString("¥pYou are number ");
  622.             NumToString(player.place+1, placeStr);
  623.             DrawString(placeStr);
  624.             DrawString("¥p on the High Score chart.");
  625.             MoveTo(textFieldRect.left-4,textFieldRect.top - 45);
  626.             DrawString("¥pNumber of Bills killed: ");
  627.             NumToString(player.totalBillsKilled, placeStr);
  628.             DrawString(placeStr);
  629.             MoveTo(textFieldRect.left-4,textFieldRect.top - 32);
  630.             DrawString("¥pNumber of Macs saved: ");
  631.             NumToString(player.totalMacsSaved, placeStr);
  632.             DrawString(placeStr);
  633.             
  634.             MoveTo(textFieldRect.left-4, textFieldRect.top - 10);
  635.             DrawString("¥pType in your name and press Enter");
  636.             
  637.             RGBForeColor(&myBlackColor);
  638.             
  639. }
  640.  
  641. //////////////////////////////////////////////////////
  642. //Draw the Victory screen with mutilated Bill
  643. //////////////////////////////////////////////////////
  644. void DrawGameWonScreen (void)
  645. {
  646.     Rect        haukurPicRect = { 10, 300, 470, 623 };
  647.     CGrafPtr    buffPort;
  648.  
  649.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  650.     
  651.     //start drawing to workmap
  652.     SetPort(buffPort);
  653.  
  654.  
  655.         RGBForeColor(&myBlackColor);
  656.         PaintRect(&screenSize);
  657.         
  658.         CopyBits((BitMap *)*haukurWinPix, GetPortBitMapForCopyBits(buffPort), &haukurWinSize, &haukurPicRect, srcCopy, nil);
  659.  
  660.  
  661.     MoveTo(100, 100);
  662.     RGBForeColor(&myWhiteColor);
  663.     TextSize(18);
  664.     TextFace(1);
  665.     DrawString("¥pVICTORY AT LAST!!!");
  666.     
  667.     TextSize(10);
  668.     TextFace(0);
  669.     MoveTo(100, 150);
  670.     DrawString("¥pAs the dust settles you wipe a sweaty brow and raise");
  671.     MoveTo(100, 165);
  672.     DrawString("¥pyour bloodsoaked chainsaw towards the sky, triumphant.");
  673.     MoveTo(100, 180);
  674.     DrawString("¥pThe twisted and mutilated corpses of Bills are strewn");
  675.     MoveTo(100, 195);
  676.     DrawString("¥peverywhere and already the vultures are moving in.");
  677.     
  678.     MoveTo(100, 220);
  679.     DrawString("¥pFinally the evil forces of corporate monopolist tyranny");
  680.     MoveTo(100, 235);
  681.     DrawString("¥phave met their match.  What does the future hold?");
  682.     MoveTo(100, 250);
  683.     DrawString("¥pIt's hard to tell whether a new dynasty of bloatware");
  684.     MoveTo(100, 265);
  685.     DrawString("¥pwill rise from the ashes of the fallen Gatesian empire.");
  686.     MoveTo(100, 280);
  687.     DrawString("¥pBut no matter what, you'll be out there...waiting, watching,");
  688.     MoveTo(100, 295);
  689.     DrawString("¥pever vigilant, oiling your chainsaw.");
  690.     
  691.     RGBForeColor(&myBlackColor);
  692.     
  693. }
  694.  
  695.  
  696.  
  697. void DrawAboutScreen (void)
  698. {
  699.     Rect        aboutSignRect = { 20, 260, 50, 380 };
  700.     Rect        macRect    = { 235, 30, 272, 70 };
  701.     Rect        steveStoryRect = { 310, 30, 374, 80 }; 
  702.     Rect        deptOfJusticeRect = { 400, 30, 450, 80 };
  703.     Rect        billStoryRect = { 70, 30, 134, 80 };
  704.     Rect        billHitRect = { 120, 355, 184, 405 };
  705.     Rect        billWinXPRect = { 210, 355, 274, 405 };
  706.     Rect        billIndignantRect = { 300, 355, 364, 405 };
  707.     Rect        billBriefcaseRect = { 390, 355, 454, 405 };
  708.     CGrafPtr    buffPort;
  709.  
  710.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  711.     
  712.     //start drawing to workmap
  713.     SetPort(buffPort);
  714.  
  715.             RGBForeColor(&myBlackColor);
  716.             PaintRect(&screenSize);
  717.             
  718.             //draw about button at top
  719.             CopyBits((BitMap *)*buttonsPix, GetPortBitMapForCopyBits(buffPort), &splashButtonSizes[2], &aboutSignRect, srcCopy, nil);
  720.             
  721.             //draw bill near storyline
  722.             CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[0], &billStoryRect, transparent, nil);
  723.             
  724.             //draw mac in storyline
  725.             CopyBits((BitMap *)*macIconPix, GetPortBitMapForCopyBits(buffPort), &macIconSizes[0], &macRect, srcCopy, nil);
  726.             
  727.             //draw steve in storyline
  728.             CopyBits((BitMap *)*stevePix, GetPortBitMapForCopyBits(buffPort), &billRects[0], &steveStoryRect, transparent, nil);
  729.             
  730.             //draw d o j in storyline
  731.             CopyBits((BitMap *)*deptOfJusticePix, GetPortBitMapForCopyBits(buffPort), &dojSize, &deptOfJusticeRect, transparent, nil);
  732.             
  733.             //draw bill hit pic
  734.             CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[2], &billHitRect, transparent, nil);
  735.             
  736.             //draw bill indignant pic
  737.             CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[3], &billWinXPRect, transparent, nil);
  738.             
  739.             //draw bill briefcase pic
  740.             CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[4], &billIndignantRect, transparent, nil);
  741.             
  742.             //draw bill briefcase pic
  743.             CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[5], &billBriefcaseRect, transparent, nil);
  744.             
  745.             
  746.             TextSize(10);
  747.             TextFace(0);
  748.             MoveTo(95,80);
  749.             RGBForeColor(&myRedColor);
  750.             DrawString("¥pBILL ");
  751.             RGBForeColor(&myWhiteColor);
  752.             DrawString("¥pis the owner of powerful software");
  753.             MoveTo(95, 95);
  754.             DrawString("¥pcompany known for its monopolistic and");
  755.             MoveTo(95, 110);
  756.             DrawString("¥ppredatory business practices, not to mention");
  757.             MoveTo(95, 125);
  758.             DrawString("¥pruthless extermination of competitors.");
  759.             
  760.             
  761.             MoveTo(30, 155);
  762.             DrawString("¥pNow Bill has ported his market-dominant operating");
  763.             MoveTo(30, 170);
  764.             DrawString("¥psystem to the Mac in an attempt to wipe out the last");
  765.             MoveTo(30, 185);
  766.             DrawString("¥premaining obstacle between him and");
  767.             RGBForeColor(&myRedColor);
  768.             DrawString("¥p COMPLETE WORLD");
  769.             MoveTo(30, 200);
  770.             DrawString("¥pDOMINATION!");
  771.             RGBForeColor(&myWhiteColor);
  772.             
  773.             
  774.             MoveTo(90, 230);
  775.             if (gOS == kMacOSClassic)
  776.                 DrawString("¥pBill will attempt to replace the trusty old MacOS");
  777.                else
  778.                    DrawString("¥pBill will attempt to replace the wonderful UNIX");
  779.                    
  780.             MoveTo(90, 245);
  781.             DrawString("¥psystem on the world's various Macs with his own");
  782.             MoveTo(90, 260);
  783.             DrawString("¥ptwisted derivative. Only ");
  784.             RGBForeColor(&myGreenColor);
  785.             DrawString("¥pYOU ");
  786.             RGBForeColor(&myWhiteColor);
  787.             DrawString("¥pand your  trusty");
  788.             MoveTo(90, 275);
  789.             RGBForeColor(&myGreenColor);
  790.             DrawString("¥pCHAINSAW ");
  791.             RGBForeColor(&myWhiteColor);
  792.             DrawString("¥pcan prevent Bill from achieving his");
  793.             MoveTo(90, 290);
  794.             DrawString("¥pmegalomaniac goal.");
  795.             
  796.             
  797.  
  798.              MoveTo(95, 320);
  799.              DrawString("¥pOn your way you will find allies to help you in");
  800.              MoveTo(95, 335);
  801.              DrawString("¥pyour noble quest.  Occasionally ");
  802.              RGBForeColor(&myBlueColor);
  803.              DrawString("¥p¥"THE MAN¥"");
  804.              RGBForeColor(&myWhiteColor);
  805.              MoveTo(95, 350);
  806.              DrawString("¥phimself will appear and undo Bill's foul");
  807.              MoveTo(95, 365);
  808.              DrawString("¥pmistreatment of his precious Macs.");
  809.             
  810.     
  811.             MoveTo(95, 400);
  812.             DrawString("¥pA lesser but also valuable ally is the ");
  813.             RGBForeColor(&myBlueColor);
  814.             DrawString("¥pDEPARTMENT");
  815.             MoveTo(95, 415);
  816.             DrawString("¥pOF JUSTICE, ");
  817.             RGBForeColor(&myWhiteColor);
  818.             DrawString("¥pwhich occasionally sees fit to prosecute");
  819.             MoveTo(95, 430);
  820.             DrawString("¥pBill for anti-trust violations.  This will slow him");
  821.             MoveTo(95, 445);
  822.             DrawString("¥pdown and distract him from the task at hand.");
  823.             
  824.             MoveTo(355, 80);
  825.             DrawString("¥pBill appears in various guises throughout the game.");
  826.             MoveTo(355, 95);
  827.             DrawString("¥pYou would do well to learn to recognize them.");
  828.     
  829.             MoveTo(420, 130);
  830.             DrawString("¥pIf you see Bill in this state, you'll");
  831.             MoveTo(420, 145);
  832.             DrawString("¥pknow you've hit him with the chainsaw.");
  833.             MoveTo(420, 160);
  834.             DrawString("¥pAfter letting out a cry of  agony, Bill");
  835.             MoveTo(420, 175);
  836.             DrawString("¥pwill disappear with a *poof*.");
  837.     
  838.             MoveTo(420, 220);
  839.             DrawString("¥pThis means Bill is loading his monstrous");
  840.             MoveTo(420, 235);
  841.             DrawString("¥pfilth on to a Mac.  At  this point, only ");
  842.             MoveTo(420, 250);
  843.             DrawString("¥pthe Department of Justice can prevent");
  844.             MoveTo(420, 265);
  845.             DrawString("¥pcontamination of the Mac in question.");
  846.             
  847.             MoveTo(420, 310);
  848.             DrawString("¥pHere Bill is protesting his innocence");
  849.             MoveTo(420, 325);
  850.             DrawString("¥pto the Department of Justice.  This");
  851.             MoveTo(420, 340);
  852.             DrawString("¥pwill take some time for him until a ");
  853.             MoveTo(420, 355);
  854.             DrawString("¥psolution is found.");
  855.             
  856.             MoveTo(420, 400);
  857.             DrawString("¥pBill's solution to the prosecution by");
  858.             MoveTo(420, 415);
  859.             DrawString("¥pthe DoJ is simple.  Nothing solves such");
  860.             MoveTo(420, 430);
  861.             DrawString("¥paffairs as efficiently as hard cash, and");
  862.             MoveTo(420, 445);
  863.             DrawString("¥pwe all know that Bill's got plenty.");
  864. }
  865.  
  866.  
  867. void DrawMoreAboutScreen (void)
  868. {
  869.     Rect        aboutSignRect = { 20, 260, 50, 380 };
  870.     Rect        billRect = { 170,  550, 234, 600 };
  871.     Rect        macIconRect1 = { 260, 40, 297, 80 };
  872.     Rect        macIconRect2 = { 260,  540 , 297, 580 };
  873.     Rect        chainsawRect = { 90, 41, 122, 73 };
  874.     Rect        steveStoryRect = { 335, 30, 399, 80 };
  875.     
  876.     CGrafPtr    buffPort;
  877.  
  878.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  879.     
  880.     //start drawing to workmap
  881.     SetPort(buffPort);
  882.     
  883.             RGBForeColor(&myBlackColor);
  884.             PaintRect(&screenSize);
  885.             
  886.             //draw about button at top
  887.             CopyBits((BitMap *)*buttonsPix, GetPortBitMapForCopyBits(buffPort), &splashButtonSizes[2], &aboutSignRect, srcCopy, nil);
  888.             
  889.             //draw chainsaw
  890.             CopyBits((BitMap *)*chainSawPix, GetPortBitMapForCopyBits(buffPort), &chainsawSizes[0], &chainsawRect, transparent, nil);
  891.             
  892.             //draw bill
  893.             CopyBits((BitMap *)*billPix, GetPortBitMapForCopyBits(buffPort), &billRects[0], &billRect, transparent, nil);
  894.             
  895.             //draw mac in storyline
  896.             CopyBits((BitMap *)*macIconPix, GetPortBitMapForCopyBits(buffPort), &macIconSizes[0], &macIconRect1, srcCopy, nil);
  897.             
  898.             //draw mac in storyline
  899.             CopyBits((BitMap *)*macIconPix, GetPortBitMapForCopyBits(buffPort), &macIconSizes[1], &macIconRect2, srcCopy, nil);
  900.             
  901.             //draw steve in storyline
  902.             CopyBits((BitMap *)*stevePix, GetPortBitMapForCopyBits(buffPort), &billRects[0], &steveStoryRect, transparent, nil);
  903.             
  904.             TextSize(10);
  905.             TextFace(0);
  906.             MoveTo(95,80);
  907.             RGBForeColor(&myWhiteColor);
  908.             DrawString("¥pThis is your trusty ");
  909.             RGBForeColor(&myRedColor);
  910.             DrawString("¥pCHAINSAW");
  911.             RGBForeColor(&myWhiteColor);
  912.             DrawString("¥p, your only reliable friend in a world riddled with Bills.  In order to use");
  913.             MoveTo(95, 95);
  914.             DrawString("¥pthe chainsaw during the game, you press down the mouse button.  This crude slaughtering mechanism");
  915.             MoveTo(95, 110);
  916.             DrawString("¥pwill then activate with a humm and remain spinning while you hold the button down.  You can then");
  917.             MoveTo(95, 125);
  918.             DrawString("¥pfreely proceed with mowing down Bills like nobody's business.  However, take care that you don't");
  919.             MoveTo(95, 140);
  920.             DrawString("¥pkeep the chainsaw active for a very long period of time since it is liable to jam.");
  921.             
  922.             MoveTo(30, 170);
  923.             DrawString("¥pUnless you play games such as these purely for the pleasure of carnage and slaughter, you'll be wanting");
  924.             MoveTo(30, 185);
  925.             DrawString("¥pto know more about points.  ");
  926.             RGBForeColor(&myGreenColor);
  927.             DrawString("¥pPOINTS ");
  928.             RGBForeColor(&myWhiteColor);
  929.             DrawString("¥pare primarily earned by killing Bills with the chainsaw.  The number");
  930.             MoveTo(30, 200);
  931.             DrawString("¥pof points earned per Bill depends on how quickly he is killed.    The less time that passes from the time");
  932.             MoveTo(30, 215);
  933.             DrawString("¥pthe Bill is spawned until he falls victim to the chainsaw, the more points you earn.    At the end of each");
  934.             MoveTo(30, 230);
  935.             DrawString("¥plevel, you will congratulated on your varying success in annihilating the bloatware peddler.");
  936.             
  937.             
  938.             MoveTo(97, 260);
  939.             DrawString("¥pAlthough you earn the most points for killing Bill, your primary objective is to protect");
  940.             MoveTo(97, 275);
  941.             DrawString("¥pthe Macs in each level from being loaded with his operating system.  At the end of each");
  942.             MoveTo(97,290);
  943.             DrawString("¥plevel you will be awarded points for healthy Macs and penalized for infected ones.    If");
  944.             MoveTo(97,305);
  945.             DrawString("¥pall the Macs become infected, you lose the game.");
  946.         
  947.             MoveTo(95, 345);
  948.             DrawString("¥pIf you accidentally kill ");
  949.             RGBForeColor(&myBlueColor);
  950.             DrawString("¥p¥"THE MAN¥"");
  951.             RGBForeColor(&myWhiteColor);
  952.             DrawString("¥pin your enthusiasm");
  953.             MoveTo(95, 360);
  954.             DrawString("¥pfor blood, you will be heavily penalized.   Collateral");
  955.             MoveTo(95,375);
  956.             DrawString("¥pdamage is not kindly regarded in xGates so please");
  957.             MoveTo(95,390);
  958.             DrawString("¥prefrain from hurting him.");
  959.             
  960.             
  961.             TextSize(12);
  962.             TextFace(1);
  963.             MoveTo(460, 374);
  964.             RGBForeColor(&myGreenColor);
  965.             DrawString("¥pTHAT'S IT.  ENJOY!");
  966.             
  967. }
  968.  
  969.  
  970. void DrawControlsScreen (void)
  971. {
  972.     Rect        mousePicSize = { 0, 0, 60, 27 };
  973.     Rect        keyboardPicSize = { 0, 0, 38, 80 };
  974.     Rect        mouseRect = { 110, 50, 170, 77 };
  975.     Rect        keyboardRect = { 220, 22, 258, 102 };
  976.     Rect        controlsSignRect = { 20, 260, 50, 380 };
  977.  
  978.     CGrafPtr    buffPort;
  979.  
  980.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  981.     
  982.     //start drawing to workmap
  983.     SetPort(buffPort);
  984.  
  985.  
  986.             RGBForeColor(&myBlackColor);
  987.             PaintRect(&screenSize);
  988.             
  989.               //draw button at top
  990.             CopyBits((BitMap *)*buttonsPix, GetPortBitMapForCopyBits(buffPort), &splashButtonSizes[1], &controlsSignRect, srcCopy, nil);
  991.             
  992.             //draw mouse
  993.             CopyBits((BitMap *)*mousePix, GetPortBitMapForCopyBits(buffPort), &mousePicSize, &mouseRect, srcCopy, nil);
  994.         
  995.             //draw keyboard
  996.             CopyBits((BitMap *)*keyboardPix, GetPortBitMapForCopyBits(buffPort), &keyboardPicSize, &keyboardRect, srcCopy, nil);
  997.         
  998.              RGBForeColor(&myWhiteColor);
  999.              TextSize(12);
  1000.              TextFace(0);
  1001.             MoveTo(120, 120);
  1002.             DrawString("¥pThe Mouse");
  1003.             
  1004.             MoveTo(120, 140);
  1005.             TextSize(10);
  1006.             DrawString("¥pThe mouse is your friend.  In xGates you will use the mouse to direct a nasty, barbed rotating");
  1007.             MoveTo(120, 155);
  1008.             DrawString("¥pchainsaw to the nearest Bill.  It is sufficient to drag the mouse over game objects while holding");
  1009.             MoveTo(120, 170);
  1010.             DrawString("¥pdown the mouse button in order to use the chainsaw on them.");
  1011.             
  1012.             
  1013.             TextSize(12);
  1014.             MoveTo(120, 220);
  1015.             DrawString("¥pThe Keyboard");
  1016.             TextSize(10);
  1017.             MoveTo(120, 240);
  1018.             DrawString("¥pYou'll find the keyboard a handy input device in the course of playing xGates.  It is the source");
  1019.             MoveTo(120, 255);
  1020.             DrawString("¥pof  several extremely useful shortcuts listed below.");
  1021.             
  1022.             TextSize(12);
  1023.             MoveTo(150, 320);
  1024.             DrawString("¥pSPACE BAR or P ");
  1025.             TextSize(10);
  1026.             DrawString("¥p   -   Pause Game");
  1027.             
  1028.             TextSize(12);
  1029.             MoveTo(150, 350);
  1030.             DrawString("¥pOPTION   ");
  1031.             TextSize(10);
  1032.             DrawString("¥p   -   Use Department of Justice Effect");
  1033.             
  1034.             TextSize(12);
  1035.             MoveTo(150, 380);
  1036.             DrawString("¥pC   ");
  1037.             TextSize(10);
  1038.             DrawString("¥p   -   Cheat to add DoJ's.  Use prevents entrance to highscore chart");
  1039.             
  1040.             TextSize(12);
  1041.             MoveTo(150, 410);
  1042.             DrawString("¥pQ   ");
  1043.             TextSize(10);
  1044.             DrawString("¥p   -   Quits game and returns you to the main game screen.");
  1045.             MoveTo(150,425);
  1046.             DrawString("¥p                 Does not prevent entrance to high score chart");
  1047. }
  1048.  
  1049.  
  1050. void DrawCreditsScreen (void)
  1051. {
  1052.     Rect        gameTitleRect = { 110, 150, 201, 483 };
  1053.     Rect        sothPicRect = { 30, 280, 130, 383 };
  1054.  
  1055.     CGrafPtr    buffPort;
  1056.  
  1057.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  1058.     
  1059.     //start drawing to workmap
  1060.     SetPort(buffPort);
  1061.     
  1062.             RGBForeColor(&myBlackColor);
  1063.             PaintRect(&screenSize);
  1064.             
  1065.             //draw game title
  1066.             CopyBits((BitMap *)*splashPix, GetPortBitMapForCopyBits(buffPort), &gameTitleSize, &gameTitleRect, srcCopy, nil);
  1067.             
  1068.             //draw soth logo
  1069.             CopyBits((BitMap *)*sothPix, GetPortBitMapForCopyBits(buffPort), &sothPicSize, &sothPicRect, srcCopy, nil);
  1070.             
  1071.             //credits
  1072.             RGBForeColor(&myGrayBlueColor);
  1073.             TextSize(10);
  1074.             TextFace(0);
  1075.             MoveTo(267, 250);
  1076.             DrawString("¥pProgramming & Graphics");
  1077.             
  1078.             RGBForeColor(&myWhiteColor);
  1079.             MoveTo(255, 270);
  1080.             TextSize(12);
  1081.             DrawString("¥pSveinbjorn Thordarson");
  1082.             
  1083.             RGBForeColor(&myGrayBlueColor);
  1084.             MoveTo(279, 300);
  1085.             TextSize(10);
  1086.             DrawString("¥pAdditional Artwork");
  1087.             
  1088.             RGBForeColor(&myWhiteColor);
  1089.             MoveTo(250, 320);
  1090.             TextSize(12);
  1091.             DrawString("¥pHaukur Valdimar Palsson");
  1092.             
  1093.             RGBForeColor(&myGrayBlueColor);
  1094.             MoveTo(279, 350);
  1095.             TextSize(10);
  1096.             DrawString("¥pAdditional Graphics");
  1097.             
  1098.             RGBForeColor(&myWhiteColor);
  1099.             MoveTo(250, 370);
  1100.             TextSize(12);
  1101.             DrawString("¥pMagnus David Magnusson");
  1102.             
  1103.             RGBForeColor(&myGrayBlueColor);
  1104.             MoveTo(224, 400);
  1105.             TextSize(10);
  1106.             DrawString("¥pxGates is inspired by the Linux game xbill");
  1107.             
  1108.             MoveTo(190, 430);
  1109.             DrawString("¥pWritten in C for the Carbon API using Metrowerks CodeWarrior");
  1110.             
  1111.             MoveTo(193, 450);
  1112.             DrawString("¥pDistributed under the terms of the GNU General Public License");
  1113.  
  1114. }
  1115.  
  1116.  
  1117. void DrawDisclaimerScreen (void)
  1118. {
  1119.     Rect        disclaimerSignRect = { 20, 260, 50, 380 };
  1120.     CGrafPtr    buffPort;
  1121.  
  1122.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  1123.     
  1124.     //start drawing to workmap
  1125.     SetPort(buffPort);
  1126.             RGBForeColor(&myBlackColor);
  1127.             PaintRect(&screenSize);
  1128.             
  1129.             //draw about button at top
  1130.             CopyBits((BitMap *)*buttonsPix, GetPortBitMapForCopyBits(buffPort), &splashButtonSizes[4], &disclaimerSignRect, srcCopy, nil);
  1131.  
  1132.             TextSize(12);
  1133.             TextFace(0);
  1134.             
  1135.             MoveTo(230, 200);
  1136.             RGBForeColor(&myGrayBlueColor);
  1137.             DrawString("¥pxGates ");
  1138.             RGBForeColor(&myWhiteColor);
  1139.             DrawString("¥pIS A COMPUTER GAME");
  1140.             MoveTo(210, 220);
  1141.             DrawString("¥pCREATED BY ");
  1142.             RGBForeColor(&myGrayBlueColor);
  1143.             DrawString("¥pSVEINBJORN THORDARSON");
  1144.             MoveTo(210, 250);
  1145.             RGBForeColor(&myWhiteColor);
  1146.             DrawString("¥pANY SIMILARITIES TO PERSONS LIVING");
  1147.             MoveTo(219,270);
  1148.             DrawString("¥pOR DEAD IS ");
  1149.             RGBForeColor(&myRedColor);
  1150.             TextFace(2);
  1151.             DrawString("¥pPURELY ");
  1152.             TextFace(0);
  1153.             RGBForeColor(&myWhiteColor);
  1154.             DrawString("¥pCOINCIDENTAL.");
  1155. }
  1156.  
  1157.  
  1158.  
  1159.  
  1160. #pragma mark -
  1161. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1162. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1163. ////////////////////////////////////////////Workmap operations//////////////////////////////////////////////
  1164. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1165. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1166.  
  1167.  
  1168. //////////////////////////////////////////////////////
  1169. //Steadily draw a greater portion of the workmap to screen
  1170. //starting from the middle, thus producing a zoom effect
  1171. //////////////////////////////////////////////////////
  1172. void ZoomBlitWorkMapToScreen (void)
  1173. {
  1174.     Rect        zoomRect;
  1175.     short        i;
  1176.     long        startTickCount;
  1177.     CGrafPtr    backBuffPort, frontBuffPort;
  1178.  
  1179.     //DSpContext_SwapBuffers(gDisplayContext, nil, nil);
  1180.  
  1181.     
  1182.        DSpContext_GetBackBuffer(gDisplayContext, kDSpBufferKind_Normal, &backBuffPort);
  1183.     DSpContext_GetFrontBuffer(gDisplayContext, &frontBuffPort);
  1184.  
  1185.     SetPort(frontBuffPort);
  1186.  
  1187.     //zoom out to the about
  1188.       for (i = 0; i < kZoomSpeed; i++)
  1189.       {
  1190.             startTickCount = TickCount();
  1191.       
  1192.             zoomRect.top = (screenSize.bottom/2)-((i+1)*(screenSize.bottom/kZoomSpeed));
  1193.             zoomRect.left = (screenSize.right/2)-((i+1)*(screenSize.right/kZoomSpeed));
  1194.             zoomRect.bottom = (screenSize.bottom/2)+((i+1)*(screenSize.bottom/kZoomSpeed));
  1195.             zoomRect.right = (screenSize.right/2)+((i+1)*(screenSize.right/kZoomSpeed));
  1196.             
  1197.             CopyBits(GetPortBitMapForCopyBits(backBuffPort), GetPortBitMapForCopyBits(frontBuffPort), &zoomRect, &zoomRect, srcCopy, nil);
  1198.             
  1199.             do {/*nothing*/ }
  1200.             while (startTickCount == TickCount());
  1201.       }
  1202.  
  1203.     SetPort(frontBuffPort);
  1204.  
  1205. }
  1206.  
  1207. //////////////////////////////////////////////////////
  1208. //Sawp buffers
  1209. //////////////////////////////////////////////////////
  1210. void BlitWorkMapToScreen (void)
  1211. {
  1212.     DSpContext_SwapBuffers(gDisplayContext, nil, nil);
  1213. }
  1214.  
  1215.  
  1216. #pragma mark -
  1217.  
  1218. //////////////////////////////////////////////////////
  1219. //Clean a designated area of the workmap offscreen gworld
  1220. //////////////////////////////////////////////////////
  1221. void  EraseWorkMapRect (Rect *theRect)
  1222. {
  1223.     CGrafPtr    buffPort, frontBuffPort;
  1224.  
  1225.     DSpContext_GetFrontBuffer(gDisplayContext, &frontBuffPort);
  1226.     DSpContext_GetBackBuffer (gDisplayContext, kDSpBufferKind_Normal, &buffPort);
  1227.     
  1228.     SetPort(buffPort);
  1229.     
  1230.     RGBForeColor(&myWhiteColor);
  1231.     PaintRect(theRect);
  1232.     RGBForeColor(&myBlackColor);
  1233.     
  1234.     SetPort(frontBuffPort);
  1235.     
  1236. }
  1237.  
  1238.  
  1239. //////////////////////////////////////////////////////
  1240. //Same as above, except black background
  1241. //////////////////////////////////////////////////////
  1242. void DrawBlackWorkMap (void)
  1243.     RGBForeColor(&myBlackColor);
  1244.     PaintRect(&screenSize);
  1245. }
  1246.  
  1247.  
  1248.  
  1249. #pragma mark -
  1250. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1251. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1252. ////////////////////////////////////////Loading/Initing GWorlds/////////////////////////////////////////////
  1253. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1254. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1255.  
  1256.  
  1257.  
  1258.  
  1259. //////////////////////////////////////////////////////
  1260. //Open PICT resource, copy it to offscreen pixmap and
  1261. //and then dispose of the handle
  1262. //////////////////////////////////////////////////////
  1263. GWorldPtr LoadPicToGWorld(short picId)
  1264. {
  1265.     CGrafPtr orgiPort;
  1266.     GDHandle orgiDev;
  1267.     PixMapHandle offPixMap;
  1268.     GWorldPtr theGWorld;
  1269.     PicHandle thePic;
  1270.     Str255      picIDString;
  1271.     QDErr error;
  1272.     Boolean good;
  1273.     
  1274.     thePic = GetPicture(picId);
  1275.     if(thePic == 0L)
  1276.     {
  1277.         NumToString(picId, picIDString);
  1278.         DoAlert("¥pFailure loading PICT resource.", picIDString);
  1279.         QuitApp();
  1280.     }
  1281.     
  1282.     GetGWorld(&orgiPort, &orgiDev);
  1283.     
  1284.     HLock((Handle)thePic);
  1285.     
  1286.     error = NewGWorld(&theGWorld, 0, &(**thePic).picFrame, nil, nil, 0);//offscreen Rect is already a ptr 
  1287.  
  1288.     if((theGWorld == nil) || (error != 0))
  1289.     {
  1290.         NumToString(picId, picIDString);
  1291.         DoAlert("¥pError creating GWorld for PICT.", picIDString);
  1292.         QuitApp();
  1293.     }
  1294.     
  1295.     SetGWorld(theGWorld, nil);
  1296.     offPixMap = GetGWorldPixMap(theGWorld);
  1297.     good = LockPixels(offPixMap);
  1298.     if(!good)
  1299.     {
  1300.         NumToString(picId, picIDString);
  1301.         DoAlert("¥pError locking GWorld.", picIDString);
  1302.         QuitApp();
  1303.     }
  1304.     
  1305.     DrawPicture(thePic, &(**thePic).picFrame);
  1306.     UnlockPixels(offPixMap);
  1307.     
  1308.     SetGWorld(orgiPort, orgiDev);
  1309.     
  1310.     ReleaseResource((Handle)thePic); 
  1311.     
  1312.     return theGWorld;
  1313. }
  1314.  
  1315.  
  1316.  
  1317.